home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / Icons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  11.6 KB  |  326 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        Icons.h
  3.  
  4.      Contains:    Icon Utilities Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ICONS__
  21. #define __ICONS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <QuickdrawText.h>                                    */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT_SUPPORTED
  44. #pragma import on
  45. #endif
  46.  
  47.  
  48. enum {
  49. /* The following are icons for which there are both icon suites and SICNs. */
  50.     genericDocumentIconResource    = -4000,
  51.     genericStationeryIconResource = -3985,
  52.     genericEditionFileIconResource = -3989,
  53.     genericApplicationIconResource = -3996,
  54.     genericDeskAccessoryIconResource = -3991,
  55.     genericFolderIconResource    = -3999,
  56.     privateFolderIconResource    = -3994,
  57.     floppyIconResource            = -3998,
  58.     trashIconResource            = -3993,
  59. /* The following are icons for which there are SICNs only. */
  60.     desktopIconResource            = -3992,
  61.     openFolderIconResource        = -3997,
  62.     genericHardDiskIconResource    = -3995,
  63.     genericFileServerIconResource = -3972,
  64.     genericSuitcaseIconResource    = -3970,
  65.     genericMoverObjectIconResource = -3969,
  66. /* The following are icons for which there are icon suites only. */
  67.     genericPreferencesIconResource = -3971,
  68.     genericQueryDocumentIconResource = -16506,
  69.     genericExtensionIconResource = -16415,
  70.     systemFolderIconResource    = -3983,
  71.     appleMenuFolderIconResource    = -3982
  72. };
  73.  
  74. enum {
  75.     startupFolderIconResource    = -3981,
  76.     ownedFolderIconResource        = -3980,
  77.     dropFolderIconResource        = -3979,
  78.     sharedFolderIconResource    = -3978,
  79.     mountedFolderIconResource    = -3977,
  80.     controlPanelFolderIconResource = -3976,
  81.     printMonitorFolderIconResource = -3975,
  82.     preferencesFolderIconResource = -3974,
  83.     extensionsFolderIconResource = -3973,
  84.     fontsFolderIconResource        = -3968,
  85.     fullTrashIconResource        = -3984,
  86.     large1BitMask                = 'ICN#',
  87.     large4BitData                = 'icl4',
  88.     large8BitData                = 'icl8',
  89.     small1BitMask                = 'ics#',
  90.     small4BitData                = 'ics4',
  91.     small8BitData                = 'ics8',
  92.     mini1BitMask                = 'icm#',
  93.     mini4BitData                = 'icm4',
  94.     mini8BitData                = 'icm8'
  95. };
  96.  
  97. /*  alignment type values  */
  98. enum {
  99.     atNone                        = 0x0,
  100.     atVerticalCenter            = 0x1,
  101.     atTop                        = 0x2,
  102.     atBottom                    = 0x3,
  103.     atHorizontalCenter            = 0x4,
  104.     atAbsoluteCenter            = atVerticalCenter | atHorizontalCenter,
  105.     atCenterTop                    = atTop | atHorizontalCenter,
  106.     atCenterBottom                = atBottom | atHorizontalCenter,
  107.     atLeft                        = 0x8,
  108.     atCenterLeft                = atVerticalCenter | atLeft,
  109.     atTopLeft                    = atTop | atLeft,
  110.     atBottomLeft                = atBottom | atLeft,
  111.     atRight                        = 0xC,
  112.     atCenterRight                = atVerticalCenter | atRight,
  113.     atTopRight                    = atTop | atRight,
  114.     atBottomRight                = atBottom | atRight
  115. };
  116.  
  117. typedef short IconAlignmentType;
  118.  
  119. /*  transform type values  */
  120.  
  121. enum {
  122.     ttNone                        = 0x0,
  123.     ttDisabled                    = 0x1,
  124.     ttOffline                    = 0x2,
  125.     ttOpen                        = 0x3,
  126.     ttLabel1                    = 0x0100,
  127.     ttLabel2                    = 0x0200,
  128.     ttLabel3                    = 0x0300,
  129.     ttLabel4                    = 0x0400,
  130.     ttLabel5                    = 0x0500,
  131.     ttLabel6                    = 0x0600,
  132.     ttLabel7                    = 0x0700,
  133.     ttSelected                    = 0x4000,
  134.     ttSelectedDisabled            = ttSelected | ttDisabled,
  135.     ttSelectedOffline            = ttSelected | ttOffline,
  136.     ttSelectedOpen                = ttSelected | ttOpen
  137. };
  138.  
  139. typedef short IconTransformType;
  140.  
  141. /*  Selector mask values  */
  142.  
  143. enum {
  144.     svLarge1Bit                    = 0x00000001,
  145.     svLarge4Bit                    = 0x00000002,
  146.     svLarge8Bit                    = 0x00000004,
  147.     svSmall1Bit                    = 0x00000100,
  148.     svSmall4Bit                    = 0x00000200,
  149.     svSmall8Bit                    = 0x00000400,
  150.     svMini1Bit                    = 0x00010000,
  151.     svMini4Bit                    = 0x00020000,
  152.     svMini8Bit                    = 0x00040000,
  153.     svAllLargeData                = 0x000000ff,
  154.     svAllSmallData                = 0x0000ff00,
  155.     svAllMiniData                = 0x00ff0000,
  156.     svAll1BitData                = svLarge1Bit | svSmall1Bit | svMini1Bit,
  157.     svAll4BitData                = svLarge4Bit | svSmall4Bit | svMini4Bit,
  158.     svAll8BitData                = svLarge8Bit | svSmall8Bit | svMini8Bit,
  159.     svAllAvailableData            = 0xffffffffL
  160. };
  161.  
  162. typedef unsigned long IconSelectorValue;
  163.  
  164. typedef pascal OSErr (*IconActionProcPtr)(ResType theType, Handle *theIcon, void *yourDataPtr);
  165.  
  166. #if GENERATINGCFM
  167. typedef UniversalProcPtr IconActionUPP;
  168. #else
  169. typedef IconActionProcPtr IconActionUPP;
  170. #endif
  171.  
  172. enum {
  173.     uppIconActionProcInfo = kPascalStackBased
  174.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  175.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  176.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle*)))
  177.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  178. };
  179.  
  180. #if GENERATINGCFM
  181. #define NewIconActionProc(userRoutine)        \
  182.         (IconActionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconActionProcInfo, GetCurrentArchitecture())
  183. #else
  184. #define NewIconActionProc(userRoutine)        \
  185.         ((IconActionUPP) (userRoutine))
  186. #endif
  187.  
  188. #if GENERATINGCFM
  189. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  190.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconActionProcInfo, (theType), (theIcon), (yourDataPtr))
  191. #else
  192. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  193.         (*(userRoutine))((theType), (theIcon), (yourDataPtr))
  194. #endif
  195.  
  196. typedef IconActionProcPtr IconAction;
  197.  
  198. typedef pascal Handle (*IconGetterProcPtr)(ResType theType, void *yourDataPtr);
  199.  
  200. #if GENERATINGCFM
  201. typedef UniversalProcPtr IconGetterUPP;
  202. #else
  203. typedef IconGetterProcPtr IconGetterUPP;
  204. #endif
  205.  
  206. enum {
  207.     uppIconGetterProcInfo = kPascalStackBased
  208.          | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  209.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  210.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  211. };
  212.  
  213. #if GENERATINGCFM
  214. #define NewIconGetterProc(userRoutine)        \
  215.         (IconGetterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconGetterProcInfo, GetCurrentArchitecture())
  216. #else
  217. #define NewIconGetterProc(userRoutine)        \
  218.         ((IconGetterUPP) (userRoutine))
  219. #endif
  220.  
  221. #if GENERATINGCFM
  222. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  223.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconGetterProcInfo, (theType), (yourDataPtr))
  224. #else
  225. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  226.         (*(userRoutine))((theType), (yourDataPtr))
  227. #endif
  228.  
  229. typedef IconGetterProcPtr IconGetter;
  230.  
  231. #if !OLDROUTINELOCATIONS
  232. struct CIcon {
  233.     PixMap                            iconPMap;                    /*the icon's pixMap*/
  234.     BitMap                            iconMask;                    /*the icon's mask*/
  235.     BitMap                            iconBMap;                    /*the icon's bitMap*/
  236.     Handle                            iconData;                    /*the icon's data*/
  237.     short                            iconMaskData[1];            /*icon's mask and BitMap data*/
  238. };
  239. typedef struct CIcon CIcon, *CIconPtr, **CIconHandle;
  240.  
  241. extern pascal CIconHandle GetCIcon(short iconID)
  242.  ONEWORDINLINE(0xAA1E);
  243. extern pascal void PlotCIcon(const Rect *theRect, CIconHandle theIcon)
  244.  ONEWORDINLINE(0xAA1F);
  245. extern pascal void DisposeCIcon(CIconHandle theIcon)
  246.  ONEWORDINLINE(0xAA25);
  247. extern pascal Handle GetIcon(short iconID)
  248.  ONEWORDINLINE(0xA9BB);
  249. extern pascal void PlotIcon(const Rect *theRect, Handle theIcon)
  250.  ONEWORDINLINE(0xA94B);
  251. #endif
  252. extern pascal OSErr PlotIconID(const Rect *theRect, IconAlignmentType align, IconTransformType transform, short theResID)
  253.  THREEWORDINLINE(0x303C, 0x0500, 0xABC9);
  254. extern pascal OSErr NewIconSuite(Handle *theIconSuite)
  255.  THREEWORDINLINE(0x303C, 0x0207, 0xABC9);
  256. extern pascal OSErr AddIconToSuite(Handle theIconData, Handle theSuite, ResType theType)
  257.  THREEWORDINLINE(0x303C, 0x0608, 0xABC9);
  258. extern pascal OSErr GetIconFromSuite(Handle *theIconData, Handle theSuite, ResType theType)
  259.  THREEWORDINLINE(0x303C, 0x0609, 0xABC9);
  260. extern pascal OSErr ForEachIconDo(Handle theSuite, IconSelectorValue selector, IconActionUPP action, void *yourDataPtr)
  261.  THREEWORDINLINE(0x303C, 0x080A, 0xABC9);
  262. extern pascal OSErr GetIconSuite(Handle *theIconSuite, short theResID, IconSelectorValue selector)
  263.  THREEWORDINLINE(0x303C, 0x0501, 0xABC9);
  264. extern pascal OSErr DisposeIconSuite(Handle theIconSuite, Boolean disposeData)
  265.  THREEWORDINLINE(0x303C, 0x0302, 0xABC9);
  266. extern pascal OSErr PlotIconSuite(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconSuite)
  267.  THREEWORDINLINE(0x303C, 0x0603, 0xABC9);
  268. extern pascal OSErr MakeIconCache(Handle *theHandle, IconGetterUPP makeIcon, void *yourDataPtr)
  269.  THREEWORDINLINE(0x303C, 0x0604, 0xABC9);
  270. extern pascal OSErr LoadIconCache(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconCache)
  271.  THREEWORDINLINE(0x303C, 0x0606, 0xABC9);
  272. extern pascal OSErr PlotIconMethod(const Rect *theRect, IconAlignmentType align, IconTransformType transform, IconGetterUPP theMethod, void *yourDataPtr)
  273.  THREEWORDINLINE(0x303C, 0x0805, 0xABC9);
  274. extern pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString)
  275.  THREEWORDINLINE(0x303C, 0x050B, 0xABC9);
  276. extern pascal Boolean PtInIconID(Point testPt, const Rect *iconRect, IconAlignmentType align, short iconID)
  277.  THREEWORDINLINE(0x303C, 0x060D, 0xABC9);
  278. extern pascal Boolean PtInIconSuite(Point testPt, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  279.  THREEWORDINLINE(0x303C, 0x070E, 0xABC9);
  280. extern pascal Boolean PtInIconMethod(Point testPt, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  281.  THREEWORDINLINE(0x303C, 0x090F, 0xABC9);
  282. extern pascal Boolean RectInIconID(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, short iconID)
  283.  THREEWORDINLINE(0x303C, 0x0610, 0xABC9);
  284. extern pascal Boolean RectInIconSuite(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  285.  THREEWORDINLINE(0x303C, 0x0711, 0xABC9);
  286. extern pascal Boolean RectInIconMethod(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  287.  THREEWORDINLINE(0x303C, 0x0912, 0xABC9);
  288. extern pascal OSErr IconIDToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, short iconID)
  289.  THREEWORDINLINE(0x303C, 0x0613, 0xABC9);
  290. extern pascal OSErr IconSuiteToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  291.  THREEWORDINLINE(0x303C, 0x0714, 0xABC9);
  292. extern pascal OSErr IconMethodToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  293.  THREEWORDINLINE(0x303C, 0x0915, 0xABC9);
  294. extern pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
  295.  THREEWORDINLINE(0x303C, 0x0316, 0xABC9);
  296. extern pascal short GetSuiteLabel(Handle theSuite)
  297.  THREEWORDINLINE(0x303C, 0x0217, 0xABC9);
  298. extern pascal OSErr GetIconCacheData(Handle theCache, void **theData)
  299.  THREEWORDINLINE(0x303C, 0x0419, 0xABC9);
  300. extern pascal OSErr SetIconCacheData(Handle theCache, void *theData)
  301.  THREEWORDINLINE(0x303C, 0x041A, 0xABC9);
  302. extern pascal OSErr GetIconCacheProc(Handle theCache, IconGetterUPP *theProc)
  303.  THREEWORDINLINE(0x303C, 0x041B, 0xABC9);
  304. extern pascal OSErr SetIconCacheProc(Handle theCache, IconGetterUPP theProc)
  305.  THREEWORDINLINE(0x303C, 0x041C, 0xABC9);
  306. extern pascal OSErr PlotIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon)
  307.  THREEWORDINLINE(0x303C, 0x061D, 0xABC9);
  308. extern pascal OSErr PlotSICNHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN)
  309.  THREEWORDINLINE(0x303C, 0x061E, 0xABC9);
  310. extern pascal OSErr PlotCIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon)
  311.  THREEWORDINLINE(0x303C, 0x061F, 0xABC9);
  312.  
  313. #if PRAGMA_IMPORT_SUPPORTED
  314. #pragma import off
  315. #endif
  316.  
  317. #if PRAGMA_ALIGN_SUPPORTED
  318. #pragma options align=reset
  319. #endif
  320.  
  321. #ifdef __cplusplus
  322. }
  323. #endif
  324.  
  325. #endif /* __ICONS__ */
  326.